<?php

include('../include/header.php');
include('../src/LivedocxBroker.php');

//load data from mysql table
$sql = "select * from resumes where username = 'noauth' order by ID desc limit 1";
$result = mysql_query($sql) or die ('SQL Error : ' . mysql_error());
$row = mysql_fetch_array($result);

if (!$result)
  {
    include('../include/header.php');
    echo "Please <a href=\"edit.php\">create</a> a resume first";
    return;
  }
else
  {
    // display PDF resume
    header('Content-type: application/pdf');
    readfile('../resumes/' . $row['username'] . '-' . $row['ID'] . '.pdf');
  }

include('../include/footer.php');
?>
